package com.gh.cloud.feign;

import feign.*;

import java.util.Map;

/**
 * @author: guohao
 * @date: 2021-02-02 11:51
 **/
public interface FeignService<T> {
    // @Headers
    @RequestLine("GET /api/documents/{contentType}")
    @Headers("Accept: {contentType}")
    String getDocumentByType(@Param("contentType") String type);


    // @QueryMap: Map or POJO
    @RequestLine("GET /find")
    T find(@QueryMap Map<String, Object> queryMap);

    @RequestLine("GET /find")
    T find(@QueryMap Contributor contributor);

    // @HeaderMap: Map
    @RequestLine("POST /")
    void post(@HeaderMap Map<String, Object> headerMap);

    // @Body
    @RequestLine("POST /")
    @Headers("Content-Type: application/xml")
    @Body("<login \"user_name\"=\"{user_name}\" \"password\"=\"{password}\"/>")
    void xml(@Param("user_name") String user, @Param("password") String password);


    @RequestLine("POST /")
    @Headers("Content-Type: application/json")
    @Body("%7B\"user_name\": \"{user_name}\", \"password\": \"{password}\"%7D")
    void json(@Param("user_name") String user, @Param("password") String password);
}
